package com.jh.gmtv.util;

import com.alibaba.fastjson.JSON;
import com.jh.gmtv.bean.ZhiBoBean;
import com.jh.gmtv.http.OkHttpClientUtils;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.List;

/**
 * Created by Mr.J on 2016/10/18.
 */

public class DownloadJsonDatas {
    public static List<ZhiBoBean> zhiBo(String path){
        try {
            String url = OkHttpClientUtils.getStringFromUrl(path);
//            Log.i("TAG", "zhiBo: --------------------------"+url);
            JSONObject json = new JSONObject(url);
            String data = json.getString("data");
            List<ZhiBoBean> zhiBoBeen = JSON.parseArray(data, ZhiBoBean.class);
            return zhiBoBeen;
        } catch (IOException e) {
            e.printStackTrace();
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return null;
    }
}
